package com.xxg.fileshand.pop

import android.content.Context
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.DeviceUtils
import com.blankj.utilcode.util.ScreenUtils
import com.blankj.utilcode.util.ToastUtils
import com.lxj.xpopup.animator.PopupAnimator
import com.lxj.xpopup.core.CenterPopupView
import com.xxg.fileshand.R
import com.xxg.fileshand.adapter.FilesAdapter
import com.xxg.fileshand.app.SetInfo
import com.xxg.fileshand.base.ext.clickWithTrigger
import com.xxg.fileshand.base.ext.dataConvert
import com.xxg.fileshand.base.ext.getApiService
import com.xxg.fileshand.base.launch
import com.xxg.fileshand.databinding.PopBorrowReturnBinding
import com.xxg.fileshand.databinding.PopTagListBinding
import com.xxg.fileshand.greendao.FilesInfoDTO
import com.xxg.fileshand.greendao.GreenDaoManager
import com.xxg.fileshand.type.OperateType
import java.util.*

/**
 * Create by Sxl on 2023/8/10.
 */
internal class PopTagList  //注意：自定义弹窗本质是一个自定义View，但是只需重写一个参数的构造，其他的不要重写，所有的自定义弹窗都是这样。
    (context: Context, var list: MutableList<FilesInfoDTO>) :
    CenterPopupView(context) {

    var mBinding: PopTagListBinding? = null

    lateinit var filesAdapter: FilesAdapter


    // 返回自定义弹窗的布局
    override fun getImplLayoutId(): Int {
        return R.layout.pop_tag_list
    }

    // 执行初始化操作，比如：findView，设置点击，或者任何你弹窗内的业务逻辑
    override fun onCreate() {
        super.onCreate()
        mBinding = PopTagListBinding.bind(popupImplView)
        findViewById<View>(R.id.tv_left)?.clickWithTrigger {
            dismiss()
        }
        findViewById<TextView>(R.id.tv_title)?.setText("标签列表")


        filesAdapter = FilesAdapter()
        mBinding?.rvFiles?.adapter = filesAdapter
        filesAdapter.setNewInstance(list)

    }

    override fun getMaxWidth(): Int {
        return ScreenUtils.getScreenWidth()
    }

}